/* Includes ------------------------------------------------------------------*/
#include "communication.h"
#include "pthread.h"

/* Private macro -------------------------------------------------------------*/

/* Private typedef -----------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/
com_receive_cb_t com_receive_cb = NULL;

/* Private function prototypes -----------------------------------------------*/

/* Private functions ---------------------------------------------------------*/

/*******************************************************************************
 * Function Name : com_init
 * Description   : com_init
 * Input         : [com_receive_cb_t cb]
 *                 - cb: callback function
 * Output        : None
 * Return        : None
 * Notes         : None
 * Attention	 : None
 *******************************************************************************/
void com_init(com_receive_cb_t cb)
{
    com_receive_cb = cb;
}

/*******************************************************************************
 * Function Name : com_receive
 * Description   : com_receive
 * Input         : NULL
 * Output        : None
 * Return        : None
 * Notes         : None
 * Attention	 : None
 *******************************************************************************/
void com_receive(void)
{
    uint8_t data[1024] = {0};
    uint16_t len = 0;
    while (true)
    {
        if (com_receive_cb != NULL)
        {
            com_receive_cb(data, len);
        }
    }
}

/************************ (C) COPYRIGHT PURESUN **** END OF FILE ***************/
